package com.whfc.base.service.impl;

import com.whfc.base.dao.AppBannerMapper;
import com.whfc.base.dto.AppBannerDTO;
import com.whfc.base.service.BannerService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author : likang
 * @version : 1.0
 */
@DubboService(interfaceClass = BannerService.class, version = "1.0.0")
public class BannerServiceImpl implements BannerService {

    private static final Integer DEFAULT_DEPT_ID = 0;

    @Autowired
    private AppBannerMapper appBannerMapper;

    @Override
    public List<AppBannerDTO> list(Integer deptId) {
        List<AppBannerDTO> list = appBannerMapper.selectBannerDTOList(deptId);
        if (list.isEmpty()) {
            list = appBannerMapper.selectBannerDTOList(DEFAULT_DEPT_ID);
        }
        return list;
    }
}
